<!DOCTYPE html>
<html lang="en">  
    <head>
        <meta charset="utf-8">
        <title> <?php echo $this->data['title']; ?></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <link href="global/css/bootstrap/bootstrap.min.css" rel="stylesheet">
        <link href="global/css/codemirror.css" rel="stylesheet">
        <link href="global/css/app.css" rel="stylesheet">
        <link rel="shortcut icon" href="global/img/favicon.ico">
        <style>.CodeMirror {border: 2px inset #dee; background: white}</style>
    </head>
    <body data-spy="scroll" data-target=".subnav">
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container"> <a class="brand">Shard Query</a>

                    <div class="nav-collapse">
                        <ul class="nav">
                            <li> <a href="schemas">Sharded Schemas</a>

                            </li>
                            <li class="active"> <a href="#">Query</a>

                            </li>
                            <li> <a href="status">Status</a>

                            </li>
                            <li> <a href="key-directory">Key Directory</a>

                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="container">
            <header class="jumbotron subhead" id="overview">
                	<h1>Query</h1>
                <p class="lead">Submit Query to Shard Query Engine</p>
            </header>
			<div class="row">
			 	<div class="span6">
					<h2>Select Sharded Schema:</h2>
				</div>
				<div class="span3">
<?php	echo "<select id='query-schemata-select' style='height:40px;margin-left:-85px;margin-top:10px'>";
				//print schemas
				foreach($this->data['schemata'] as $s){	 
		         	if($this->data['schema_id'] == $s->id)
						echo "<option selected='selected' value='" . $s->id . "'>" . $s->schema_name . "</option>";
					else
		    			echo "<option value='" . $s->id . "'>" . $s->schema_name . "</option>";
				}
		        echo "</select>";   
?>   	
				</div>
			</div>
            <div class="row">
                <div class="span12">
                    <form class="form-horizontal well">
                        <legend>Submit Query</legend>
                        <textarea id="sql-textarea">
                        </textarea>
                        <br />
                        <input id="submit-button" class="btn btn-primary" type="button" value="Submit">
                    </form>
                </div>
            </div>
            <div id="div-query-result" class="row hide">
                <h1>Query Results</h1>
<div class="alert alert-success">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  <h4>Success!</h4>
 Query Planner / Run time stats
</div>
                <table id="table-query-result" class="table table-bordered">
                    <thead id="table-head-query-result"></thead>
                    <tbody id="table-body-query-result"></tbody>
                </table>
            </div>
        </div>
        <!-- /container -->
        <!-- scripts -->
        <script>var schema_id = <?php echo $data['schema_id']; ?></script>
        <script src="global/js/jquery-1.7.2.min.js"></script>
        <script src="global/js/bootstrap/bootstrap.min.js"></script>
        <script src="global/js/codemirror/codemirror.js"></script>
        <script src="global/js/codemirror/mysql.js"></script>
        <script src="global/js/query.js"></script>
    </body>

</html>
